package chapter12_1;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import chapter12_1.bean.ScoreDao;
import chapter12_1.bean.StudentDao;
import chapter12_1.bean.UserDao;
// 测试类
public class AopTest {
    public static void main(String args[]) {
        String xmlPath = "chapter12_1/applicationContext.xml";
        ApplicationContext applicationContext =
                new ClassPathXmlApplicationContext(xmlPath);
        // 从Spring容器中获得代理的对象
        UserDao userDao =
                (UserDao) applicationContext.getBean("userDaoProxy");
        StudentDao studentDao =
                (StudentDao) applicationContext.getBean("studentDaoProxy");
        ScoreDao scoreDao =
                (ScoreDao) applicationContext.getBean("scoreDaoProxy");

        // 执行方法，进行业务处理
        userDao.deleteUser();
        studentDao.deleteStudent();
        scoreDao.deleteScore();
    }
}

